package com.sykj.springboott1.controller;

import com.sykj.springboott1.pojo.Emp;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class WebController {
    //获取配置文件中的属性值，${emp.eid}是应用属性的 key
    @Value("${emp.eid}")
    long eid;
    @Value("${emp.ename}")
    String ename;
    @Value("${emp.sex}")
    String sex;
    @Value("${emp.age}")
    long age;
    @Value("${emp.salary}")
    long salary;

    @GetMapping("hello")
    @ResponseBody
    public Emp sayHello(String name){
        Emp emp=new Emp();
        emp.setEid(eid);
        emp.setEname(ename);
        emp.setSex(sex);
        emp.setAge(age);
        emp.setSalary(salary);
        return emp;
    }

}
